Ok this took a while.  I am quite convinced that there is a more elegant solution, but I couldn't figure it out myself, made something that worked and didn't want to take it past that.  Really really interesting puzzle and metric.